// This is example source code. It demonstrates the use of the ACRViewer API.
// 
// Jens Breitenborn, 95/05/03


#import "ACRViewer.h"

// The file specified in the command line is opened in ACRViewer.
// The Threshold operator is applied to the image with
// varying parameters.

main(int argc, char *argv[])
{
int i;
id acrviewer= [[ACRViewer alloc] init];

	if (argc != 2){
		puts("usage:threshloop acr/nema-filename");
		exit(1);
	}
	
	if (!acrviewer) {
		puts("Could not get API for ACRViewer!\n"
			 "Probably ACRViewer isn't placed in the\n"
			 "WorkspaceManagers' search path.\n");
		exit(1);
	}

	if ([acrviewer openACRFile:argv[1] ]){
		[acrviewer useOperator:"Threshold"];
		for (i=0; i<2000; i+= 100){
			char params[256];
			sprintf(params,"Low=%d;High=%d",i,i+200);
			[acrviewer setParameters:params forOperator:"Threshold"];
		}
		[acrviewer useOperator:""];
	}
	
}
